<!--
 * @Description: 
 * @Author: your name
 * @Date: 2025-03-03 08:46:42
 * @LastEditors: your name
 * @LastEditTime: 2025-03-03 09:00:44
 * @FilePath: /2305/chapter05/week3/1.1组件的基本使用.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>组件的基本使用</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="app">
        <global-component></global-component><!--使用全局组件-->
        <local-component></local-component><!--使用局部组件-->
    </div>

    <script type="text/javascript">
        //注册一个全局组件
        Vue.component('global-component', {
            // ... 选项 ...
            template: '<div>全局组件</div>'
        })
        var app = new Vue({
            el: '#app',
            data: {

            },
            // 注册局部组件
            components: {
                //局部组件
                'local-component': {
                    template: '<div>局部组件</div>'
                }
            }
        })
    </script>
</body>

</html>